// OBB.h
//
//////////////////////////////////////////////////////////////////////
	
#ifndef __OBB_H__
#define __OBB_H__

#include "Geometry.h"
#include "BVolume.h"

typedef std::deque<OBB *> OBBList;

class OBB : public BVolume{
public:
	OBB(Geometry * g);
	OBB(const OBBList &);

	int OverlapPlane(Plane P) const;
	int EdgeIntersect(Point3D Start, Point3D End) const;
	int RayIntersect(Point3D Start, Point3D Dir, float& InT, float& OutT) const;
	int OverlapVF(ViewFrustum* VF) const;
	virtual LIB3D_RETURN updateTransform(const Matrix3D & t);
	virtual LIB3D_RETURN updateVolume();
	
protected:
	Vector3D Xaxis() const;
	Vector3D Yaxis() const;
	Vector3D Zaxis() const;
	void FindTightFit();
	Matrix3D GetCovariance();
	Matrix3D GetBestOrientation();

protected:
	Point3D obbV[8];      
	Matrix3D pR;   
	Vector3D pT, Dim; 

};

#endif

